import java.util.Scanner;

public class 猜数字新 {
    public static void main(String[] args) {
        Scanner SC=new Scanner(System.in);
        String sf;
        int sjs = (int) (Math.random() * 100 + 1);
        System.out.println("猜一个一到一百之间的数字");
        int cai;
        do{
            int cs=7;
            while (cs!=0) {
                try {
                    cai= SC.nextInt();
                }catch (Exception e){
                    System.out.println("输入一个一到一百之间的数字");
                    SC.next();
                    continue;
                }
                if (cai > sjs) {
                    System.out.println("猜大了！");
                } else if (cai < sjs) {
                    System.out.println("猜小了！");
                } else {
                    System.out.println("猜对了！");
                    break;
                }
                cs--;
            }
            if (cs==0){ System.out.println("超过7次游戏失败,是否继续游戏(是/否)"); }
            else {System.out.println("是否重新游戏(是/否)");}
            sf= SC.next();
        }while (sf.equalsIgnoreCase("是"));
    }
}